﻿using Business;
using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookManageSys
{
    public partial class AdminLogin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(username.Text) || string.IsNullOrEmpty(password.Text))
            {
                Response.Write("<script>alert('用户名或密码不能为空');</script>");
                return;
            }

            AdminsEntity ae = new AdminsEntity();
            ae.Account = username.Text;

            AdminsBusiness ab = new AdminsBusiness();
            if (password.Text == ab.GetPasswordByAccount(ae).ToString())
            {
                Session["AdminName"] = username.Text;
                Response.Write("<script>alert('登录！'),location.href='/Admin/BookManage.aspx'</script>");
            }else
            {
                Response.Write("<script>alert('账号或密码错误！')</script>");
            }
        }

    }
}